package com.example.mypic;

import com.example.mypic.utils.Utils;

import android.app.Activity;
import android.content.pm.ActivityInfo;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ImageView;
import android.widget.ZoomControls;

public class DetailActivity extends Activity {
	private ZoomControls zoom;
	private ImageView image;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_detail);
//		setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
		zoom = (ZoomControls) findViewById(R.id.zoomControls1);
		image = (ImageView) findViewById(R.id.imageView1);
		
		int key = getIntent().getExtras().getInt(Utils.KEY, -1);
		
		if(key != -1){
			image.setImageDrawable(Utils.recent.get(key));
		}
		zoom.setOnZoomInClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
//				Log.d("Size", "Zoom IN");
				image.setScaleX(image.getScaleX() * 1.2f);
				image.setScaleY(image.getScaleY() * 1.2f);
			}

		});
		zoom.setOnZoomOutClickListener(new OnClickListener() {

			@Override
			public void onClick(View v) {
				// TODO Auto-generated method stub
//				Log.d("Size", "Zoom OUT");
				image.setScaleX(image.getScaleX() / 1.2f);
				image.setScaleY(image.getScaleY() / 1.2f);
			}
		});
	}
}
